<?php
include_once('includes/db.php');
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$email=$_POST['email'];
$uname=$_POST['uname'];
$pword=$_POST['pword'];

$sql="SELECT * FROM user WHERE uname='$uname' OR email='$email'";
$res=mysql_query($sql);
$n=mysql_num_rows($res);
if($n==0)
	{
		$str="INSERT INTO `user` values('','$fname','$lname','$email','$uname','$pword','user')";
		$result=mysql_query($str);
		if($result)
		{
			echo 'You are successfully registered';
		}
		else 
		{
			echo 'failure';	
		}
	}
else
	echo "User Already exists";

?>